/**
 * @file 设备相关类型定义
 * @description 定义与设备相关的数据类型
 * @date 2024-06-18
 */

import { BaseEntity, Timestamp } from './common';
import { LocationWithAddress } from './map';

/**
 * 设备状态枚举
 */
export enum DeviceStatus {
  OFFLINE = 0,
  ONLINE = 1
}

/**
 * 设备数据类型
 */
export interface Device extends BaseEntity {
  name: string;
  type?: string;
  status: DeviceStatus; // 设备状态枚举
  lastPosition?: string;
  lastUpdateTime?: Timestamp;
  description?: string;
  attributes?: Record<string, any>;
}

/**
 * 设备统计数据
 */
export interface DeviceStats {
  total: number;
  online: number;
  offline: number;
  byType: Record<string, number>;
}

/**
 * 设备属性项
 */
export interface DeviceAttribute {
  key: string;
  value: string | number | boolean;
  label?: string;
  unit?: string;
}

/**
 * 设备位置数据
 */
export interface DeviceLocation extends LocationWithAddress {
  deviceId: string;
  timestamp: Timestamp;
  speed?: number;
  direction?: number;
  altitude?: number;
  accuracy?: number;
} 